<?php
namespace app\index\controller\Gatewayworker;
use \GatewayWorker\Lib\Gateway;

class Events{
    public static function onConnect($client_id)    {
       Gateway::sendToCurrentClient("Your client_id is $client_id");
    }
    public static function onWorkerStart($businessWorker)    {
       echo "WorkerStart 启动了\n";
    }
      public static function onMessage($client_id, $message)    {
        // 群聊，转发请求给其它所有的客户端
        return GateWay::sendToAll($message);
    }
    public static function onClose($client_id)    {
       // 广播 xxx logout
       GateWay::sendToAll("client[$client_id] logout\n");
    }
    public static function onWorkerStop($businessWorker)    {
       echo "WorkerStop\n";
    }
}